<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var reg=/1/g;
        var p="12345";
        /* test():获取字符串中是否包含正则表达式匹配的字符，只要包含就返回true */
        console.log(reg.test(p))
    </script>
</body>
</html>